package com.snail.starter.config;

import com.snail.starter.function.FormatProcessor;

/**
 * @title: HelloFormatTemplate
 * @Author liwenbo
 * @Date: 2021/8/25 16:09
 */
public class HelloFormatTemplate {

    private FormatProcessor formatProcessor;

    public HelloFormatTemplate(FormatProcessor formatProcessor) {
        this.formatProcessor = formatProcessor;
    }
   //定义一个格式化方法，具体的实现由FormatProcessor实现类实现

    public <T> String doFormat(T obj) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("begin:Execute format").append("<br/>");
        stringBuilder.append("Obj format result:").append(formatProcessor.format(obj)).append("<br/>");
        return stringBuilder.toString();

    }
}
